/**
 * Copyright (c) 2009, http://www.softwareinlife.com. All rights reserved.
 * 
 * Redistribution and use in source and binary forms, 
 * with or without modification, are permitted provided that 
 * the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice, 
 *    this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright notice, 
 *    this list of conditions and the following disclaimer in the documentation 
 *    and/or other materials provided with the distribution.
 * 
 * 3. Neither the name of the http://www.softwareinlife.com nor the names of its 
 *    contributors may be used to endorse or promote products derived from 
 *    this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE SOFTWAREINLIFE AND CONTRIBUTORS "AS IS" 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. 
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package com.softwareinlife.vision.android.system.exceptions;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

/**
 * BaseException for Global Exception Handling
 * 
 * @author Jang, Sun-Jin(jangsunjin@softwareinlife.com)
 * @date 2009. 10. 10.
 */
public class BaseException extends Exception {

	/**
	 * Serial Version UID
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * Exceptions
	 */
	private List<Exception> exceptions = null;
	
	/**
	 * Constructor
	 */
	public BaseException() {
		exceptions = new ArrayList<Exception>(0);
	}

	/**
	 * @param detailMessage
	 */
	public BaseException(String detailMessage) {
		super(detailMessage);
		exceptions = new ArrayList<Exception>(0);
	}

	/**
	 * @param throwable
	 */
	public BaseException(Throwable throwable) {
		super(throwable);
		exceptions = new ArrayList<Exception>(0);
	}

	/**
	 * @param detailMessage
	 * @param throwable
	 */
	public BaseException(String detailMessage, Throwable throwable) {
		super(detailMessage, throwable);
		exceptions = new ArrayList<Exception>(0);
	}

	/**
	 * @param object
	 * @return
	 * @see java.util.List#add(java.lang.Object)
	 */
	public boolean add(Exception object) {
		return exceptions.add(object);
	}

	/**
	 * @param location
	 * @param object
	 * @see java.util.List#add(int, java.lang.Object)
	 */
	public void add(int location, Exception object) {
		exceptions.add(location, object);
	}

	/**
	 * @param arg0
	 * @return
	 * @see java.util.List#addAll(java.util.Collection)
	 */
	public boolean addAll(Collection<? extends Exception> arg0) {
		return exceptions.addAll(arg0);
	}

	/**
	 * @param arg0
	 * @param arg1
	 * @return
	 * @see java.util.List#addAll(int, java.util.Collection)
	 */
	public boolean addAll(int arg0, Collection<? extends Exception> arg1) {
		return exceptions.addAll(arg0, arg1);
	}

	/**
	 * 
	 * @see java.util.List#clear()
	 */
	public void clear() {
		exceptions.clear();
	}

	/**
	 * @param object
	 * @return
	 * @see java.util.List#contains(java.lang.Object)
	 */
	public boolean contains(Object object) {
		return exceptions.contains(object);
	}

	/**
	 * @param arg0
	 * @return
	 * @see java.util.List#containsAll(java.util.Collection)
	 */
	public boolean containsAll(Collection<?> arg0) {
		return exceptions.containsAll(arg0);
	}

	/**
	 * @param location
	 * @return
	 * @see java.util.List#get(int)
	 */
	public Exception get(int location) {
		return exceptions.get(location);
	}

	/**
	 * @return
	 * @see java.util.List#iterator()
	 */
	public Iterator<Exception> iterator() {
		return exceptions.iterator();
	}

	/**
	 * @param location
	 * @return
	 * @see java.util.List#remove(int)
	 */
	public Exception remove(int location) {
		return exceptions.remove(location);
	}

	/**
	 * @return
	 * @see java.util.List#size()
	 */
	public int size() {
		return exceptions.size();
	}
}
